package Java学习.方法;

public class 方法的重载 {
    //比较2个整数是否相同(byte,short,int,long)
    public static void main(String[] args) {
        compare(10,20);

    }
    //相同功能的方法名启成一样的
    //好处1:定义的时候单词量小
    //好处2:易于调用
    public static void compare(byte a1,byte a2){
        System.out.println("byte");
        System.out.println(a1==a2);
    }
    public static void compare(short b1,short b2) {
        System.out.println("shout");
        System.out.println(b1 == b2);
    }
    public static void compare(int c1,int c2) {
        System.out.println("int");
        System.out.println(c1 == c2);
    }
    public static void compare(long d1,long d2) {
        System.out.println("long");
        System.out.println(d1 == d2);
    }


}
